package com.wdf.dota;

import java.io.InputStream;

import com.wdf.bean.Dota2HeroSkill;

import android.app.Activity;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.drawable.Drawable;
import android.os.Bundle;
import android.text.Html;
import android.widget.ImageView;
import android.widget.TextView;

public class Dota2HeroSkillActivity extends Activity {


	

	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.hero_skill);

		try {
		Bundle bundle = this.getIntent().getExtras();
		String heroname =	bundle.getString("heroname");
     
		Dota2HeroSkill skill = new Dota2HeroSkill();
		

		String skill1=skill.getClass().getField(heroname+"_skill1").get(skill).toString();
		String skill2 =skill.getClass().getField(heroname+"_skill2").get(skill).toString();
		String skill3 =skill.getClass().getField(heroname+"_skill3").get(skill).toString();
		String skill4 =skill.getClass().getField(heroname+"_skill4").get(skill).toString();
		

			ImageView  skill1map= (ImageView ) findViewById(R.id.skill1map);
			TextView skill1description= (TextView) findViewById(R.id.skill1description);
			ImageView  skill2map = (ImageView ) findViewById(R.id.skill2map);
			TextView skill2description = (TextView) findViewById(R.id.skill2description);
			ImageView  skill3map = (ImageView ) findViewById(R.id.skill3map);
			TextView skill3description = (TextView) findViewById(R.id.skill3description);
			ImageView  skill4map = (ImageView ) findViewById(R.id.skill4map);
			TextView skill4description = (TextView) findViewById(R.id.skill4description);

			

			skill1description.setText(Html.fromHtml(skill1));
			skill2description.setText(Html.fromHtml(skill2));
			skill3description.setText(Html.fromHtml(skill3));
			skill4description.setText(Html.fromHtml(skill4));

			
			String skill1Path =  "dota2/"+heroname+"_skill1.jpg"; 
			String skill2Path =  "dota2/"+heroname+"_skill2.jpg"; 
			String skill3Path =  "dota2/"+heroname+"_skill3.jpg"; 
			String skill4Path =  "dota2/"+heroname+"_skill4.jpg"; 


			InputStream fis1 = getAssets().open( skill1Path);
            Bitmap bm1 = BitmapFactory.decodeStream(fis1);
            skill1map.setImageBitmap(bm1);
			InputStream fis2 = getAssets().open( skill2Path);
            Bitmap bm2 = BitmapFactory.decodeStream(fis2);
            skill2map.setImageBitmap(bm2);
			InputStream fis3 = getAssets().open( skill3Path);
            Bitmap bm3 = BitmapFactory.decodeStream(fis3);
            skill3map.setImageBitmap(bm3);
			InputStream fis4 = getAssets().open( skill4Path);
            Bitmap bm4 = BitmapFactory.decodeStream(fis4);
            skill4map.setImageBitmap(bm4);


		} catch (Exception e) {
			e.printStackTrace();
		}
		
		
	}
}
